import React from "react";
import { Router, Route, Switch, Redirect } from "dva/router";
import App from "./routes/App";
import Film from "./routes/Film";
import Cinemas from "./routes/Cinemas";
import Center from "./routes/Center";
import Detail from "./routes/Detail";

function RouterConfig({ history }) {
  return (
    <Router history={history}>
      <Switch>
        <Route
          path="/"
          render={() => (
            <App>
              <Switch>
                <Route path="/film" component={Film}></Route>
                <Route path="/cinemas" component={Cinemas}></Route>
                <Route path="/center" component={Center}></Route>
                <Route path="/detail/:id" component={Detail}></Route>
                <Redirect from="/" to="/film"></Redirect>
              </Switch>
            </App>
          )}
        ></Route>
      </Switch>
    </Router>
  );
}

export default RouterConfig;
